var App = getApp();
//Page Object
Page({
    data: {
        orderList: [],
        page: {
            page: 1,
            pageSize: 10
        },
    },
    //options(Object)
    onLoad: function (options) {
        this.getData()
    },
    onReady: function () {

    },
    getData: function () {
        const _this = this
        App.globalData.serviceModel.orderList({
            data: _this.data.page
        }).then(json => {
            if (_this.data.page == 1)
                _this.setData({
                    orderList: json.data.list
                })
            else {
                _this.setData({
                    orderList: _this.data.orderList.concat(json.data.list)
                })
            }
            _this.setData({
                'page.page': _this.data.page.page + 1
            })
        })
    },
    onReachBottom: function () {
        this.getData()
    },
    goOrderInfo: function (event) {
        wx.navigateTo({
            url: '/pages/person/order/detail/detail?id='+event.currentTarget.dataset.id,        
        });
    }
});